package io;

import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;

/**
 * @author Cheng Jun
 * Description: 字节打印流，只有输出流，没有输入流。就是用来打印的，自然没有输入流
 * @version 1.0
 * @date 2022/8/14 20:52
 * @see PrintStream
 */
public class PrintStreamExample {

    public static void main(String[] args) throws IOException {
        String str = "PrintStream 字节打印流输出";
        PrintStream output = System.out;
        output.print(str);
        // 追加模式写入
        FileOutputStream fileOutputStream = new FileOutputStream("src/io/TestFile/ForChar.txt", true);
        PrintStream printStream = new PrintStream(fileOutputStream);
        System.setOut(printStream);
        System.out.println(str);
    }


}
